<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:t="http://myfaces.apache.org/tomahawk">
<ui:composition>
	<t:div style="width:150px">
		<h:panelGrid columns="1" style="text-align:center">
			<h:graphicImage url="#{data.image}" width="150" height="150" style="border: thin solid #4BBDD6;cursor:pointer;" onclick="enlargeImage('#{data.image}')"/>
			<h:outputText value="Mã: #{data.name}" style="font-weight:bold;"/>
			<h:outputText value="Còn: #{data.quantity}" rendered="#{not empty data.quantity}"/>
			<h:outputText value="Còn: không giới hạn" rendered="#{empty data.quantity}"/>
			<h:outputText value="Giá: call" styleClass="price" rendered="#{empty data.price}"/>
			<h:outputText value="#{data.price}k" styleClass="price" rendered="#{not data.sale and not empty data.price}"/>
			<t:div style="width:100%">
				<div align="center">
					<h:panelGrid columns="3" rendered="#{data.sale and not empty data.price and not empty data.salePrice}">
						<h:outputText value="#{data.price}k" styleClass="previousPrice" />
						<h:graphicImage value="#{config.server}/img/client/arrow.png" />
						<h:outputText value="#{data.salePrice}k" styleClass="price"/>	
					</h:panelGrid>
				</div>
			</t:div>
			<t:div style="width:100%" rendered="#{(empty data.quantity or data.quantity gt 0) and not empty data.price}">
				<div align="center">
					<h:panelGrid columns="2">
						<h:commandLink value="Mua" action="#{orderBean.orderOne}">
							<f:setPropertyActionListener value="#{data.id}" target="#{orderBean.orderedProductId}"></f:setPropertyActionListener>
						</h:commandLink>
						<h:commandLink value="Thêm vào giỏ">
							<f:param name="addedProductId" value="#{data.id}"/>
							<f:ajax event="click" render=":cartForm:content" listener="#{cartBean.add}"/>
						</h:commandLink>
					</h:panelGrid>
				</div>
			</t:div>
		</h:panelGrid>
		<div style="width: 100%" align="center">
			<h:graphicImage url="#{config.server}/img/client/hot.PNG" rendered="#{data.special}"/>
		</div>	
	</t:div>
</ui:composition>
</html>